﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EmaMetadata;
using System.Windows.Forms;
using System.Data;

namespace EmaEditor
{
    public static class DataGridViewHelper
    {
        /// <summary>
        /// Retrieve a fact from a data grid row
        /// </summary>
        /// <param name="cbx"></param>
        /// <returns></returns>
        public static EmaFact GetFact(this DataGridViewRow row)
        {
            try
            {
                string ns = Convert.ToString(row.Cells["Namespace"].Value);
                int id = Convert.ToInt32(row.Cells["ID"].Value);
                EmaFact f = new EmaFact() { NS = ns, ID = id };
                return f;
            }
            catch
            {
                return null;
            }

            

        }
    }
}
